package com.imooc.db;

import java.io.IOException;
import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class Database {
	
	public SqlSession getSession() throws IOException{
		
		Reader reader=Resources.getResourceAsReader("configuration.xml");
		
		SqlSessionFactory sessionFactory=new SqlSessionFactoryBuilder().build(reader);
		
		SqlSession session=sessionFactory.openSession();
		
		return session;
	}
	

}
